<template>
  <div v-if="!orgName" class="top-right-nav">
    <p class="welcome" @click="dologin" style="margin-right:20px;cursor:pointer;color:#B91D1F;">
      <img src="./img/icon/user.png" style="width:30px;height:30px;"/>登录
    </p>
    <p class="welcome" @click="register" style="margin-right:20px;cursor:pointer;color:#B91D1F;">
      <img src="./img/icon/reg.png" style="width:30px;height:30px;"/>注册
    </p>
    <p class="welcome" @click="help" style="margin-right:20px;cursor:pointer;color:#B91D1F;">
      <img src="./img/icon/help.png" style="width:30px;height:30px;"/>帮助
    </p>
  </div>
  <div v-else class="top-right-nav">
    <p class="welcome" style="margin-right:20px;">{{orgName?orgName+'，欢迎您':''}}</p>
    <p class="welcome" @click="logout" style="margin-right:20px;cursor:pointer;color:#751415;">{{orgName?'退出':''}}</p>
    <p class="welcome" @click="help" style="margin-right:20px;cursor:pointer;color:#B91D1F;">
      <img src="./img/icon/help.png" style="width:30px;height:30px;"/>帮助
    </p>
    <!-- <p class="welcome" @click="customer" style="cursor:pointer;color:#B91D1F;">
      <img src="./img/icon/user.png" style="width:30px;height:30px;"/>用户服务
    </p> -->

    <!-- <router-link to="/">
      <img src="./img/icon/home.png" alt="">
      首页
    </router-link> -->
    <!-- <router-link to="/">
      <img src="./img/icon/user.png" alt="">
      登录
    </router-link> -->
    <!-- <router-link to="/">
      <img src="./img/icon/reg.png" alt="">
      注册
    </router-link> -->
    <!-- <router-link to="/">
      <img src="./img/icon/help.png" alt="">
      帮助
    </router-link> -->
    <!-- <router-link to="/">
      <img src="./img/icon/setting.png" alt="">
      语言
    </router-link> -->
  </div>
</template>

<script>
  import axios from "axios";
  import myIframe from "../../components/iframe/index"
  export default {
    props: {
      
    },

    data(){
        return{
          orgName: sessionStorage.getItem('orgName'),
        }
    },

    created() {
      
    },

    methods: {
      async logout() {
          this.$parent.$parent.spinner = true
          this.visibleLook = false
          sessionStorage.setItem('token', '')
          sessionStorage.setItem('orgName', '')
          this.$router.push({
              name: 'index'
          })
          location.reload()
      },

      help() {
        window.open("https://jdts.library.sh.cn/cover/help.pdf","_blank")
      },

      dologin() {
        window.open("https://dhapi.library.sh.cn/management/webapi/cenofmagent/token/locpage?systemId=20&durl=https://jdts.library.sh.cn")
      },

      register() {
        window.open("https://dhapi.library.sh.cn/management/webapi/cenofmagent/token/register?systemId=20&redirectUrl=https://jdts.library.sh.cn")
      },

      customer() {
        window.open('https://www.cnbksy.cn/portal/footCategory?id=82', '_blank');
        // this.$layer.iframe({
        //   type: 2, //0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
        //   content: {
        //     content: myIframe,
        //     parent: this,
        //     data: {},
        //   },
        //   area: ["605px", "566px"],
        //   title: "自助客服",
        // });
      },

    },
  }
</script>

<style lang="less" scoped>
  .welcome {
    font-size: 1.35rem;
    font-weight: bolder;
    color: #053549;
    float: left;
  }
  .top-right-nav{
    position: absolute;
    top: .3rem;
    right: .2rem;
    text-align: center;
    a{
      display: inline-block;
      width: .5rem;
      text-align: center;
      color: #751415;
      line-height: 2;
      font-size: .24rem;
      margin: 0 .1rem;
      img{
        display: block;
        width: .5rem;
        height: .5rem;
        margin: 0 auto;
      }
    }
    @media(min-width: 768px){
      position: absolute;
      top: 50px;
      right: 70px;
      text-align: right;
      a{
        display: inline-block;
        width: 50px;
        text-align: center;
        color: #751415;
        line-height: 2;
        font-size: 16px;
        margin: 0 5px;
        img{
          display: block;
          width: 30px;
          height: 30px;
          margin: 0 auto;
        }
      }
    }
  }
</style>